#ifndef _C_FLASH_BASE_H_
#define _C_FLASH_BASE_H_
#include "../../ImageHelper/IImageHelper.h"
#include "../IFashBase.h"
#include "FlashContainer.h"
#include "FlashCallArgus.h"
#include <vector>
#include "../FlashDll/resource.h"

namespace BFFlash
{

	class CFlashBase:public IFlashBase,public IFlashContainerEvent
	{
		//CFlashBase( HWND hWnd,BFImageHelper::IImageFactory * pImgFactory,HRESULT * phr,LPCWSTR lpszPath);
		CFlashBase( HWND hWnd,HRESULT * phr/*,LPCWSTR lpszPath*/);
		virtual ~CFlashBase();
		BaseObjectImpl();
		//IFlashBase
		/*virtual double load(LPCWSTR strUrl,LPCWSTR lpURL);
		virtual HRESULT show(double playerID,BOOL bShow);
		virtual HRESULT play(double playerID);
		virtual HRESULT pause(double playerID);
		virtual HRESULT resume(double playerID);
		virtual HRESULT seekFrame(double playerID,LONG toFrame);
		virtual HRESULT seekTime(double playerID,LONG toTimeSec);
		virtual HRESULT stop(double playerID);
		virtual HRESULT close(double playerID);

		virtual HRESULT setVolume(double playerID,float nVol);
		virtual LONG	getVolume(double playerID);
		virtual LONG	getVideoWidth(double playerID);
		virtual LONG    getVideoHeight(double playerID);
		virtual float   getFPS(double playerID);
		virtual float   getVideoDuration(double playerID);
		virtual LONG    getVideoFrames(double playerID);

		
		virtual float   getcurFrame(double playerID);
		virtual HRESULT setSize(double playerID,LONG nWidth,LONG nHeight);
		virtual LONG    getWidth(double playerID);
		virtual LONG    getHeight(double playerID);
		virtual HRESULT setPosition(double playerID,LONG x,LONG y);
		virtual LONG    getX(double playerID);
		virtual LONG    getY(double playerID);

		virtual LONG    getWidth();
		virtual LONG    getHeight();*/

		//virtual void    advise(IFashEvent * pFlashEvent){}

		virtual HRESULT setSize(LONG nWidth,LONG nHeight);
		virtual HRESULT load(LPCWSTR strUrl,LPCWSTR strType );
		virtual HRESULT show(LPCWSTR strName,BOOL bShow);
		virtual HRESULT showAll(BOOL bShow);
		virtual HRESULT play(LPCWSTR strName);
		virtual HRESULT pause(LPCWSTR strName);
		virtual HRESULT resume(LPCWSTR strName);
		virtual HRESULT stop(LPCWSTR strName);
		virtual HRESULT close(LPCWSTR strName);
		virtual HRESULT closeAll();
		virtual HRESULT setVolume(LPCWSTR strName,float nVol);
		virtual HRESULT setScheme(LPCWSTR strName,LPCWSTR strPath,int nShowCount = 0);
		virtual HRESULT setSize(LPCWSTR strName,LONG nWidth,LONG nHeight);
		virtual HRESULT setPosition(LPCWSTR strName,LONG x,LONG y);
		virtual LONG    getMaterielCount( LPCWSTR strName );
		virtual LONG   getcurTime(LPCWSTR strName);
		virtual void    advise(IFlashEvent * pFlashEvent);
		virtual void    unadvise(IFlashEvent * pFlashEvent);

		virtual HRESULT setAttribute(LPCWSTR strName,LPCWSTR strAttribute,LPCWSTR strValue);
		//virtual BOOL    releaseSwf(LPCTSTR lpName,LPCTSTR lpType,LPCTSTR filename);

		//IFlashContainerEvent
		virtual HRESULT OnDraw();
		virtual HRESULT OnChangeImageHelper(BFImageHelper::IImageHelper * pImgHelper);
		virtual HRESULT OnFSCommand(LPCWSTR pCmd,LPCWSTR pArgs);
		virtual HRESULT OnFlashCall(LPCWSTR request,VARIANT * pRes);
		// 	//IComponentEventObserver
		// 	virtual LONG OnBeforeEvent(IComponentEvent * pComponentEvent);
		// 	virtual LONG OnAfterEvent(HRESULT hrCallRet,IComponentEvent * pComponentEvent);

		IFlashContainer * m_pFlashContainer;
		//CBFBaseObjPtr<CFlashCallArgus> m_pFlashCallArgus;
		std::vector<IFlashEvent*> m_pFlashEvent;

		CBFBaseObjPtr<BFImageHelper::IImageFactory>		m_pImageFactory;
		CBFBaseObjPtr<BFImageHelper::IImageHelper>		m_spDrawImage;
		CBFBaseObjPtr<BFImageHelper::IImageHelper>		m_spOldImage;

		HWND m_hWndParent;
		virtual HRESULT OnWindowMessage( UINT uMsg, WPARAM wParam, LPARAM lParam,LRESULT * lResult);
		// 	CBFBaseObjPtr<IImagePanel>			m_spImagePanel;

	public:
		//static HRESULT create( HWND hWnd,BFImageHelper::IImageFactory * pFactory,IFlashBase ** ppFlashBase,LPCWSTR lpszPath);
		static HRESULT create( HWND hWnd,IFlashBase ** ppFlashBase/*,LPCWSTR lpszPath*/);

	};
}
#endif//_C_FLASH_BASE_H_